package com.onpositive.collections;

import com.onpositive.notes.services.BasicCollectionRegistry;

public class BasicCollectionMember<T> implements ICollectionMember<T> {

	private static final long serialVersionUID = -5338675586984770740L;
	
	public BasicCollectionMember(String name) {
		super();
		this.name = name;
	}
	
	private int id ;
	private int collectionId ;
	private String name ;	

	@Override
	public String getName() {
		return name;
	}

	@Override
	public int getId() {
		return id;
	}

	@Override
	public void setId(int id) {
		this.id = id ;
	}

	@Override
	public IObjectCollection getCollection() {		
		return BasicCollectionRegistry.getInstance().getCollection(collectionId) ;
	}

	@Override
	public void setCollectionId(int collectionId) {
		this.collectionId = collectionId ;
	}

	@Override
	public int getCollectionId() {
		return collectionId ;
	}

	@SuppressWarnings("unchecked")
	@Override
	public T getCurrentValue() {
		return (T) getCollection().getCurrentValue(this);
	}
}
